package projectmanagement.managementtool.TaskServices;
/**
 * @author Zhimolokhov Oleg
 *
 */
import projectmanagement.managementtool.IdGenerator;
import projectmanagement.managementtool.ProjectServices.ProjectService;
import projectmanagement.managementtool.ProjectServices.ProjectServiceImpl;
import projectmanagement.models.Project;
import projectmanagement.models.Task;

import java.util.List;

public class TaskServiceImpl implements TaskService {

    public Task createTask(int estimationOfTask, String descriptionOfTask){
        Task task = new Task(estimationOfTask,descriptionOfTask);
        task.setId(IdGenerator.generate(Task.class));
        return task;
    }

    public void showTaskDetails(Task task) {
        task.toString();
    }
    
    public Task getTaskById(Project p, int taskId){
        List<Task> taskList = p.getTaskList();
        for(Task t : taskList){
            if(taskId == t.getId())
            return t;
        }
        return null;
    }
}